//
//  SeedbackViewController.m
//  Mtime2.0
//
//  Created by 凉气的Mac on 16/9/24.
//  Copyright © 2016年 凉气的Mac. All rights reserved.
//

#import "SeedbackViewController.h"

@interface SeedbackViewController ()<UITextViewDelegate>

@property(nonatomic,strong)  UINavigationBar *navBar;

@property(nonatomic,strong)  UINavigationItem *navItem;

@property(nonatomic,weak) UILabel *tempLabel;

@property(nonatomic,weak) UILabel *callTempLabel;

@end

@implementation SeedbackViewController


- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor lightGrayColor];
    
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"menu_top_bg"] forBarMetrics:UIBarMetricsDefault];
   
    [self setupNavigationBar];
    [self setupUI];
    
    
}

-(void)setupNavigationBar{

    UIButton *rightBtn = [UIButton creatWithTitle:@"留言记录" color:[UIColor whiteColor] fontSize:14];
    
    rightBtn.frame = CGRectMake(0, 0, 80, 30);
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:rightBtn];

}

-(void)setupUI{

    UITextView *textView = [[UITextView alloc]init];
    
    textView.delegate = self;
    
    [self.view addSubview:textView];
    
    [textView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.width.equalTo(self.view);
        
        make.top.equalTo(self.view).offset(10);
        
        make.height.equalTo(@100);
        
    }];
    
    
    
    UITextView *callNumView = [[UITextView alloc]init];
    
    [self.view addSubview:callNumView];
    
    [callNumView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(textView.mas_bottom).offset(0.5);
        
        make.left.width.equalTo(self.view);
        
        make.height.equalTo(@30);
        
    }];
    
    
    UILabel *tempLabel = [UILabel creatWithTitle:@"请输入您的反馈..." color:[UIColor blackColor] fontSize:14];

    self.tempLabel = tempLabel;
    
    [textView addSubview:tempLabel];
    
    [tempLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.left.equalTo(textView).offset(5);
        
    }];
    
    UILabel *callTempLabel = [UILabel creatWithTitle:@"请输入您的电话号码..." color:[UIColor blackColor] fontSize:14];
    
    self.callTempLabel = callTempLabel;
    
    [callNumView addSubview:callTempLabel];
    
    [callTempLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.left.equalTo(textView).offset(5);
        
    }];
    
    
    
}

-(void)textViewDidChange:(UITextView *)textView{

 
    self.tempLabel.hidden = !(textView.text == nil);
    
    self.callTempLabel.hidden = !(textView.text == nil);

}




@end











